﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace stopwatch
{
    class Stopwatch
    {
        private DateTime starttime;
        private TimeSpan timelaps;
        private TimeSpan totalSumOfTime;
        private bool isStarted;

        public void Starting()
        {
            if (!isStarted)
            {
                starttime = DateTime.Now;
                Console.WriteLine("Timer is started.");
            }
            else
            {
                Console.WriteLine("Incorrect entering. Unable to enter \"Start\" more than once in a row. Please choose correct button.");
            }
            isStarted = true;
            
        }

        public void Stopping()
        {
            if (isStarted)
            {
                timelaps = DateTime.Now - starttime;
                totalSumOfTime += timelaps;
                Console.WriteLine("Time of the lap - {0} seconds.", timelaps.Seconds);
                Console.WriteLine("Total time passed - {0.ss} seconds.", totalSumOfTime.Seconds);
            }
            else
            {
                Console.WriteLine("Incorrect entering. Unable to enter \"Stop\" before starting or after resetiing timer. Please choose correct button.");
            }
            isStarted = false;
        }

        public void Reset()
        {
            totalSumOfTime = TimeSpan.Zero;
            Console.WriteLine("Timer is reseted. Please choose next action.");
            isStarted = false;
        }
     

    }
}
